//
//  MyPublishCell.m
//  TuYouAPP
//
//  Created by L on 14-2-26.
//
//

#import "MyPublishCell.h"

@implementation MyPublishCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}
-(CGFloat)upDateCell:(TYUserState *)apub
{
    float originY = 25.0;
    CGSize constraint = CGSizeMake(290, CGFLOAT_MAX);
    CGSize size ;
    CGRect rect;
    
    size = [apub.mContext sizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];

    rect = self.publishContent.frame;
    rect.origin.y = 24;
    rect.size.height = size.height+5;
    self.publishContent.frame = rect;
    
    
 
   rect = self.botView.frame;
    rect.origin.y = self.publishContent.frame.size.height +self.publishContent.frame.origin.y +5;
   // self.botView.frame = rect;
    
    if (apub.mImgArr ==nil ||apub.mImgArr.count == 0) {
        rect = self.frame;
        rect.size.height = self.publishContent.frame.origin.y+self.publishContent.frame.size.height +40;
        self.frame = rect;
    }
   if (apub.mImgArr && apub.mImgArr.count >0) {
       

        if (apub.mImgArr.count<=3) {
            rect.size.height = 80;
            self.botView.frame = rect;
        }
        
        
        else if (apub.mImgArr.count>3&&apub.mImgArr.count<=6) {
            rect.size.height = 160;
            self.botView.frame = rect;
        }
        else if (apub.mImgArr.count>6)
        {
            rect.size.height = 240;
            self.botView.frame = rect;
        }
       
       rect = self.frame;
       rect.size.height = self.botView.frame.origin.y+self.botView.frame.size.height +40;
       self.frame = rect;
   }
  
  
 
    return originY;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
